<?php

abstract class printFormatter {

	private $name;
	private $aliases = array();
	private $description = "";
	private $devices = array();
	private $image;
	private $dependencies = array("print.js");
	private $cells = array();
	private $rows;
	private $columns;
	private $margin = array("x" => 10, "y" => 10);

	abstract protected function getConfigOptions();

	abstract public function getCellDefaultHeight();
	abstract public function getCellDefaultWidth();

	public function setName($name){
		$this->name = $name;
	}
	
	public function setAliases(array $aliases){
		$this->aliases = $aliases;
	}
	
	public function setDescription($description){
		$this->description = $description;
	}

	public function addDevice($identifier, $friendlyName, $icon = "", $picture = ""){
		array_push( $this->devices, array("ident" => $identifier, "name" => $friendlyName, "icon" => $icon, "picture" => $picture) );
	}
	
	public function setImage($image){
		$this->image = $image;
	}
	
	public function addDependency($file){
		array_push( $this->dependencies, $file );
	}
	
	public function defineCells(array $cells){
		$this->cells = $cells;
	}

	public function defineRows($rows){
		$this->rows = $rows;
	}

	public function defineColumns($columns){
		$this->columns = $columns;
	}
	
	public function defineMargin($marginx, $marginy = ""){
		$this->margin = array("x" => $marginx, "y" => ($marginy == "") ? $marginx : $marginy);
	}

	public function getFormatName(){
        return $this->name;
    }
    
    public function getCells(){
    	return $this->cells;
    }
    
    public function getCellCount(){
    	return $this->columns * $this->rows;
    }
    
    public function getRows(){
    	return $this->rows;
    }
    
    public function getColumns(){
    	return $this->columns;
    }

	public function getMargin(){
		return $this->margin;
	}
    
    public function getConfig(){
    	return $this->getConfigOptions();
    }
    
    public function getDependencies(){
    	return $this->dependencies;
    }
    
    public function getDevices(){
    	return $this->devices;
    }
    
    public function getDescription(){
    	return $this->description;
    }
    
    public function getLayout(){
    
    }
    
    public function getImage(){
    	return $this->image;
    }
    
    public function get(){
		return array(
			"name" => $this->getFormatName(),
			"identifier" => get_class($this),
			"description" => $this->getDescription(),
			"columns" => $this->getColumns(),
			"rows" => $this->getRows(),
			"cellCount" => $this->getCellCount(),
			"cells" => $this->getCells(),
			"margins" => $this->getMargin(),
			"dependencies" => $this->getDependencies(),
			"devices" => $this->getDevices(),
			"image" => $this->getImage()
		);    
    }

}

?>